﻿Imports System
Imports System.IO
Imports System.Data.SqlServerCe
Imports System.Drawing
Imports System.Collections
Imports System.Windows.Forms
Imports System.Data
Imports System.Data.Common

Public Class frmWeldInput

    Sub initScreen()        
        loadHeatNoForCbo(cboWeldInputHeat1, cboWeldInputHeat2)
        loadJointTypeForCbo(cboWeldInputJointType1, cboWeldInputJointType2)

        loadCouponSystemForCbo(cboWeldInputSystem, _COUPON_BARCODE)

        loadZone(cboWeldInputArea)

        chkWeldInputReplaceWeld.Checked = False
        chkWeldInputCouponOut.Checked = False

        lblWeldInputBarcode2.Text = "Barcode Ref"

        hideBarcodeRef()
        txtWeldInputBarcodeI.Text = ""
        txtWeldInputBarcodeO1.Text = ""

        Me.tabWeldInput.SelectedIndex = 0
        Me.tabWeldInput.Refresh()
    End Sub

    Sub showBarcodeRef()
        lblWeldInputBarcode2.Visible = True
        txtWeldInputBarcodeO1.Visible = True

        Dim nextY As Integer = lblWeldInputBarcode2.Location.Y + 20
        chkWeldInputCouponOut.Location = New System.Drawing.Point(chkWeldInputCouponOut.Location.X, nextY)
        chkWeldInputReplaceWeld.Location = New System.Drawing.Point(chkWeldInputReplaceWeld.Location.X, nextY)

        Dim buttonY As Integer = nextY + 22
        btnWeldConfirm.Location = New System.Drawing.Point(btnWeldConfirm.Location.X, buttonY)
        btnWeldCancel.Location = New System.Drawing.Point(btnWeldCancel.Location.X, buttonY)
    End Sub

    Sub hideBarcodeRef()
        lblWeldInputBarcode2.Visible = False
        txtWeldInputBarcodeO1.Visible = False

        Dim nextY As Integer = 227
        chkWeldInputCouponOut.Location = New System.Drawing.Point(chkWeldInputCouponOut.Location.X, nextY)
        chkWeldInputReplaceWeld.Location = New System.Drawing.Point(chkWeldInputReplaceWeld.Location.X, nextY)

        Dim buttonY As Integer = nextY + 22
        btnWeldConfirm.Location = New System.Drawing.Point(btnWeldConfirm.Location.X, buttonY)
        btnWeldCancel.Location = New System.Drawing.Point(btnWeldCancel.Location.X, buttonY)
    End Sub

    Private Sub btnWeldCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWeldCancel.Click
        If (_FROM_SCREEN_ID = SCREEN_COUPON_LIST) Then
            _FROM_SCREEN_ID = _SCREEN_ID
            _SCREEN_ID = SCREEN_COUPON_LIST

            frmCouponList.Show()
            frmCouponList.initScreen()
            Me.Hide()
        End If
    End Sub

    Private Sub btnWeldConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWeldConfirm.Click
        Dim returnExecute As Boolean = False
        Dim pipeTube As String = lblWeldInputPT.Text
        Dim isCoax As String = lblWeldInputIsCoax.Text
        Dim coax As String = lblWeldInputCoax.Text
        Dim heatId1 As String = ""
        Dim heatName1 As String = cboWeldInputHeat1.Text
        Dim heatId2 As String = ""
        Dim heatName2 As String = cboWeldInputHeat2.Text        

        If (isCoax = "T") Then
        Else
            If (txtWeldInputBarcodeI.Text <> "" And checkBarcodeDuplicationForWeldlogDetail(txtWeldInputBarcodeI.Text, _WELDLOG_DETAIL_ID)) Then
                MsgBox(txtWeldInputBarcodeI.Text & " alraedy exists.", MsgBoxStyle.Information, "EQAM")
                Return
            End If
        End If

        If (chkWeldInputReplaceWeld.Checked = False And txtWeldInputBarcodeO1.Text <> "" And checkBarcodeDuplicationForWeldlogDetail(txtWeldInputBarcodeO1.Text, _WELDLOG_DETAIL_ID)) Then
            MsgBox(txtWeldInputBarcodeO1.Text & " alraedy exists.", MsgBoxStyle.Information, "EQAM")
            Return
        ElseIf (chkWeldInputReplaceWeld.Checked = True) Then

            If (txtWeldInputBarcodeO1.Text = "") Then
                MsgBox("Rejected Barcode cannot be blank.", MsgBoxStyle.Information, "EQAM")
                Return
            End If
            Dim dtRejectedWeld As New DataTable
            dtRejectedWeld = findWeldLogs(Nothing, txtWeldInputBarcodeO1.Text, Nothing, WELDLOG_STATUS_REJECTED, Nothing, Globals.COUPON_TYPE_IN, True, Nothing, _PROJECT_ID)

            If dtRejectedWeld.Rows.Count = 0 Then
                MsgBox(txtWeldInputBarcodeO1.Text & " is not rejected weld.", MsgBoxStyle.Information, "EQAM")
                Return
            End If
        End If

        Dim dtResult As New DataTable
        dtResult = findHeatNos(Nothing, cboWeldInputHeat1.Text)
        If dtResult.Rows.Count > 0 Then
            heatId1 = dtResult.Rows(0).Item("HEAT_NUMBER_ID")
        End If

        dtResult = findHeatNos(Nothing, cboWeldInputHeat2.Text)
        If dtResult.Rows.Count > 0 Then
            heatId2 = dtResult.Rows(0).Item("HEAT_NUMBER_ID")
        End If

        Dim jointTypeCode1 As String = ""
        Dim jointTypeName1 As String = cboWeldInputJointType1.Text
        Dim jointTypeCode2 As String = ""
        Dim jointTypeName2 As String = cboWeldInputJointType2.Text
        dtResult = findJointTypes(cboWeldInputJointType1.Text)
        If dtResult.Rows.Count > 0 Then
            jointTypeCode1 = dtResult.Rows(0).Item("JOINT_TYPE_CODE")
        End If

        dtResult = findJointTypes(cboWeldInputJointType2.Text)
        If dtResult.Rows.Count > 0 Then
            jointTypeCode2 = dtResult.Rows(0).Item("JOINT_TYPE_CODE")
        End If

        Dim systemId As String = cboWeldInputSystem.SelectedValue
        Dim systemName As String = cboWeldInputSystem.Text

        Dim zoneId As String = cboWeldInputArea.SelectedValue
        Dim zoneName As String = cboWeldInputArea.Text
        'dtResult = findSystemTypes(Nothing, cboWeldInputSystem.Text)
        'If dtResult.Rows.Count > 0 Then
        'systemId = dtResult.Rows(0).Item("SYSTEM_TYPE_ID")
        'End If

        Dim seq As Integer = Nothing
        If (txtWeldInputSeq.Text <> "") Then
            Try
                seq = Convert.ToDecimal(txtWeldInputSeq.Text)
            Catch ex As Exception
                'seq
            End Try
        End If

        If btnWeldConfirm.Text = Globals.BUTTON_LABEL_CONFIRM Then
            If (chkWeldInputCouponOut.Checked = True) Then

                returnExecute = doCreateCoupon(_USER_ID, coax, _PROJECT_ID, lblWeldInputMaterial.Text, lblWeldInputSize.Text, lblWeldInputThickness.Text, isCoax, pipeTube, Globals.COUPON_TYPE_OUT, heatId1, heatName1, heatId2, heatName2, Nothing, "", txtWeldInputBarcodeI.Text, jointTypeCode1, jointTypeName1, jointTypeCode2, jointTypeName2, lblWeldInputWeldMachineId.Text, txtWeldInputWeldMachineName.Text)
                If returnExecute = True Then
                    MsgBox("Coupon Out Successfully.", MsgBoxStyle.Information, "EQAM")

                    _FROM_SCREEN_ID = _SCREEN_ID
                    _SCREEN_ID = SCREEN_COUPON_LIST

                    frmCouponList.Show()
                    frmCouponList.initScreen()
                    Me.Hide()
                Else
                    'MessageBox.Show("Error!")
                    Return
                End If
            ElseIf (chkWeldInputReplaceWeld.Checked = True) Then
                Dim rejectedWeldId As String = ""
                dtResult = findWeldLogs(Nothing, txtWeldInputBarcodeO1.Text, Nothing, Nothing, Nothing, Nothing, False, Nothing, _PROJECT_ID)

                If dtResult.Rows.Count > 0 Then
                    rejectedWeldId = dtResult.Rows(0).Item("WELDLOG_DETAIL_ID")
                End If

                If (rejectedWeldId = "") Then
                    MsgBox("Invalid Barcode.", MsgBoxStyle.Information, "EQAM")
                    Return
                End If

                If (seq = Nothing) Then
                    seq = getWeldLogDetailMaxSeq(_COUPON_CODE)
                End If

                returnExecute = saveRejectedWeldNo(_PROJECT_ID, rejectedWeldId, txtWeldInputBarcodeO1.Text, txtWeldInputBarcodeI.Text, _COUPON_CODE, seq)

                If returnExecute = True Then
                    MsgBox("Replace Weld Successfully.", MsgBoxStyle.Information, "E-QAM")
                    initScreen()
                End If
            Else
                If (txtWeldInputBarcodeI.Text = "") Then
                    If (isCoax = "T") Then
                        MsgBox("Barcode cannot be blank.", MsgBoxStyle.Exclamation, "E-QAM")
                    End If

                    txtWeldInputBarcodeI.Focus()
                    Return
                End If

                If (isCoax = "T" And coax = "Outer" And chkWeldInputCouponOut.Checked = False) Then
                    If (txtWeldInputBarcodeO1.Text = "") Then
                        MsgBox("Barcode Reference cannot be blank.", MsgBoxStyle.Exclamation, "E-QAM")
                        txtWeldInputBarcodeO1.Focus()
                        Return
                    End If
                End If

                If (seq = Nothing) Then
                    seq = getWeldLogDetailMaxSeq(_COUPON_CODE)
                End If

                returnExecute = doCreateWeldLog(_USER_ID, txtWeldInputBarcodeO1.Text, txtWeldInputBarcodeI.Text, systemId, systemName, heatId1, heatName1, heatId2, heatName2, jointTypeCode1, jointTypeName1, jointTypeCode2, jointTypeName2, seq, zoneId, zoneName)
                If returnExecute = True Then
                    If MsgBox("Click YES for next scan", MsgBoxStyle.YesNo, "E-QAM") = vbYes Then
                        txtWeldInputBarcodeO1.Text = ""
                        txtWeldInputBarcodeI.Text = ""
                        txtWeldInputSeq.Text = ""
                        txtWeldInputBarcodeI.Focus()
                    Else
                        _FROM_SCREEN_ID = _SCREEN_ID
                        _SCREEN_ID = SCREEN_COUPON_LIST

                        frmCouponList.Show()
                        frmCouponList.initScreen()
                        Me.Hide()
                    End If
                Else
                    'MessageBox.Show("Error!")
                    Return
                End If
            End If
        ElseIf btnWeldConfirm.Text = Globals.BUTTON_LABEL_UPDATE Then
            returnExecute = updateWeldLog(_USER_ID, txtWeldInputBarcodeO1.Text, txtWeldInputBarcodeI.Text, systemId, systemName, heatId1, heatName1, heatId2, heatName2, jointTypeCode1, jointTypeName1, jointTypeCode2, jointTypeName2, seq, _WELDLOG_DETAIL_ID, zoneId, zoneName)
            If returnExecute = True Then
                MsgBox("Update Successfully.", MsgBoxStyle.Information, "EQAM")
                txtWeldInputBarcodeO1.Text = ""
                txtWeldInputBarcodeI.Text = ""
                txtWeldInputSeq.Text = ""
                txtWeldInputBarcodeI.Focus()

                btnWeldConfirm.Text = BUTTON_LABEL_CONFIRM
                _ACTION = Globals.BUTTON_LABEL_START
            Else
                'MessageBox.Show("Error!")
                Return
            End If
        End If
    End Sub

    Sub startCouponInput(ByVal couponId As String)
        Dim dtResult As New DataTable
        dtResult = findEngineerCoupons(_PROJECT_ID, vbNullString, vbNullString, vbNullString, couponId, vbNullString, vbNullString)

        If dtResult.Rows.Count > 0 Then
            Dim dataRow As DataRow = dtResult.Rows(0)
            _COUPON_ID = couponId
            _COUPON_BARCODE = dataRow.Item("BARCODE").ToString

            If (_ACTION = Globals.BUTTON_LABEL_START) Then
                frmCreateCoupon.btnSaveCoupon.Text = Globals.BUTTON_LABEL_CONFIRM
                txtWeldInputBarcodeO1.Text = ""
                txtWeldInputBarcodeI.Text = ""
                chkWeldInputCouponOut.Checked = False
            ElseIf (_ACTION = Globals.BUTTON_LABEL_EDIT) Then
                frmCreateCoupon.btnSaveCoupon.Text = Globals.BUTTON_LABEL_UPDATE
            End If

            Dim tubeType As String = dataRow.Item("MATERIAL").ToString & "-" & dataRow.Item("SIZE").ToString & "-" & dataRow.Item("THICKNESS").ToString
            lblWeldInputMaterial.Text = dataRow.Item("MATERIAL").ToString
            lblWeldInputSize.Text = dataRow.Item("SIZE").ToString
            lblWeldInputThickness.Text = dataRow.Item("THICKNESS").ToString

            lblWeldInputWeldMachineId.Text = dataRow.Item("WELD_MACHINE_ID").ToString
            txtWeldInputWeldMachineName.Text = dataRow.Item("WELD_MACHINE_NAME").ToString

            Dim pipeTube As String = dataRow.Item("PIPE_TUBE").ToString
            lblWeldInputPT.Text = pipeTube
            If pipeTube = "PIPE" Then
                tubeType = tubeType & " (PIPE)"
            ElseIf pipeTube = "TUBE" Then
                tubeType = tubeType & " (TUBE)"
            End If

            Dim isCoax As String = dataRow.Item("IS_COAX").ToString
            lblWeldInputIsCoax.Text = isCoax
            If (isCoax = "T") Then
                Dim coaxString As String = dataRow.Item("COAX").ToString
                tubeType = tubeType & " " & coaxString
                lblWeldInputCoax.Text = coaxString

                lblWeldInputBarcode1.Text = "Barcode"

                If (coaxString = "Inner") Then
                    hideBarcodeRef()
                Else
                    showBarcodeRef()
                End If
            Else
                lblWeldInputCoax.Text = ""
                lblWeldInputBarcode1.Text = "Barcode"

                lblWeldInputBarcode2.Visible = False
                txtWeldInputBarcodeO1.Visible = False
            End If

            txtWeldInputTubeType.Text = tubeType
            _COUPON_CODE = dataRow.Item("COUPON_CODE").ToString
            _COUPON_TYPE = dataRow.Item("COUPON_TYPE").ToString

            cboWeldInputHeat1.Text = dataRow.Item("HEAT_NUMBER_NAME_1").ToString
            cboWeldInputHeat2.Text = dataRow.Item("HEAT_NUMBER_NAME_2").ToString
            cboWeldInputJointType1.Text = dataRow.Item("JOINT_TYPE_NAME_1").ToString
            cboWeldInputJointType2.Text = dataRow.Item("JOINT_TYPE_NAME_2").ToString
        Else
            MsgBox("Invalid Action (ERR002)", MsgBoxStyle.Exclamation, "EQAM")
        End If        
    End Sub

    Private Sub frmWeldInput_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
        _FROM_SCREEN_ID = _SCREEN_ID
        _SCREEN_ID = SCREEN_PROJECT

        frmProject.Show()
        frmProject.initScreen()
        Me.Hide()
    End Sub

    Private Sub Tab2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabWeldInput.SelectedIndexChanged
        If (Me.tabWeldInput.SelectedIndex = 1) Then
            refreshLvWeldInput()
            Me.tabWeldInput.Refresh()
        End If
    End Sub

    Sub refreshLvWeldInput()
        Dim dtResult As New DataTable
        Dim lstView As New ListViewItem

        dtResult = findWeldLogs(_COUPON_CODE, Nothing, Nothing, Nothing, Nothing, Globals.COUPON_TYPE_IN, False, Nothing, _PROJECT_ID)

        Me.lvWeldInput.Items.Clear()
        If dtResult.Rows.Count > 0 Then
            For Each dataRow As DataRow In dtResult.Rows
                lstView = Me.lvWeldInput.Items.Add(New ListViewItem(dataRow.Item("BARCODE").ToString))

                lstView.SubItems.Add(dataRow.Item("BARCODE_REF").ToString)
                lstView.SubItems.Add(dataRow.Item("SEQ").ToString)
                lstView.SubItems.Add(dataRow.Item("SYSTEM_TYPE_NAME").ToString)
                lstView.SubItems.Add(dataRow.Item("HEAT_NUMBER_NAME_1").ToString & "-" & dataRow.Item("HEAT_NUMBER_NAME_2").ToString)
                lstView.SubItems.Add(dataRow.Item("JOINT_TYPE_NAME_1").ToString & "-" & dataRow.Item("JOINT_TYPE_NAME_2").ToString)
                'lstView.SubItems.Add(dataRow.Item("MATERIAL")) & "-" & dataRow.Item("SIZE")) & "-" & dataRow.Item("THICKNESS")))

                lstView.Tag = dataRow.Item("WELDLOG_DETAIL_ID").ToString
            Next
        End If
    End Sub

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemMenu.Click
        frmMenu.Show()
        frmMenu.initScreen()
        Me.Hide()
    End Sub

    Private Sub chkWeldInputCouponOut_CheckStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkWeldInputCouponOut.CheckStateChanged
        If (chkWeldInputCouponOut.Checked = True) Then
            chkWeldInputReplaceWeld.Checked = False            
        End If
        hideBarcodeRef()        
    End Sub

    Private Sub chkWeldInputReplaceWeld_CheckStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkWeldInputReplaceWeld.CheckStateChanged

        If (chkWeldInputReplaceWeld.Checked = True) Then
            chkWeldInputCouponOut.Checked = False

            lblWeldInputBarcode2.Text = "Rejected Barcode"
            showBarcodeRef()
        Else
            lblWeldInputBarcode2.Text = "Barcode Ref"
            hideBarcodeRef()
        End If

    End Sub

    Private Sub btnWeldInputDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWeldInputDelete.Click
        Dim list As New ArrayList
        If MsgBox("Are you sure want to delete?", MsgBoxStyle.YesNo, "E-QAM") = vbYes Then
            Dim lstItem As ListViewItem
            For Each lstItem In lvWeldInput.Items
                If (lstItem.Checked) Then
                    Dim seqId As String = lstItem.Tag
                    list.Add(seqId)
                End If
            Next

            deleteWeldLog(list)

            refreshLvWeldInput()
        End If
    End Sub

    Private Sub btnWeldInputEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWeldInputEdit.Click
        Dim sic As ListView.SelectedIndexCollection
        sic = lvWeldInput.SelectedIndices()
        Dim selectedWeldId As String = ""

        If sic.Count <> 0 Then
            selectedWeldId = lvWeldInput.Items(sic.Item(0)).Tag

            btnWeldConfirm.Text = BUTTON_LABEL_UPDATE
            _ACTION = Globals.BUTTON_LABEL_EDIT
            editWeldLog(selectedWeldId)
        End If

        ' checkbox for edit
        Dim list As New ArrayList
        Dim lstItem As ListViewItem
        For Each lstItem In lvWeldInput.Items
            If (lstItem.Checked) Then
                Dim seqId As String = lstItem.Tag
                List.Add(seqId)
            End If
        Next

        If list.Count > 1 Then
            MsgBox("Not allow for multiple edit.", MsgBoxStyle.Exclamation, "EQAM")
        ElseIf list.Count = 1 Then
            selectedWeldId = list(0).ToString

            btnWeldConfirm.Text = BUTTON_LABEL_UPDATE
            _ACTION = Globals.BUTTON_LABEL_EDIT
            editWeldLog(selectedWeldId)
        End If
    End Sub

    Private Sub tabWeldInput_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabWeldInput.SelectedIndexChanged
        If (Me.tabWeldInput.SelectedIndex = 1) Then
            refreshLvWeldInput()
            Me.tabWeldInput.Refresh()
        End If
    End Sub

    Sub editWeldLog(ByVal weldId As String)
        Dim dtResult As New DataTable
        dtResult = findWeldLogs(vbNullString, vbNullString, vbNullString, vbNullString, weldId, Globals.COUPON_TYPE_IN, False, Nothing, _PROJECT_ID)

        If dtResult.Rows.Count > 0 Then
            Dim dataRow As DataRow = dtResult.Rows(0)
            _WELDLOG_DETAIL_ID = weldId

            Dim tubeType As String = dataRow.Item("MATERIAL") & "-" & dataRow.Item("SIZE") & "-" & dataRow.Item("THICKNESS")
            lblWeldInputMaterial.Text = dataRow.Item("MATERIAL")
            lblWeldInputSize.Text = dataRow.Item("SIZE")
            lblWeldInputThickness.Text = dataRow.Item("THICKNESS")
            txtWeldInputSeq.Text = dataRow.Item("SEQ")

            lblWeldInputWeldMachineId.Text = dataRow.Item("WELD_MACHINE_ID").ToString
            txtWeldInputWeldMachineName.Text = dataRow.Item("WELD_MACHINE_NAME").ToString

            Dim pipeTube As String = dataRow.Item("PIPE_TUBE")
            lblWeldInputPT.Text = pipeTube
            If pipeTube = "PIPE" Then
                tubeType = tubeType & " (PIPE)"
            ElseIf pipeTube = "TUBE" Then
                tubeType = tubeType & " (TUBE)"
            End If

            Dim isCoax As String = dataRow.Item("IS_COAX")
            lblWeldInputIsCoax.Text = isCoax
            If (isCoax = "T") Then
                Dim coaxString As String = dataRow.Item("COAX")
                tubeType = tubeType & " " & coaxString
                lblWeldInputCoax.Text = coaxString

                lblWeldInputBarcode1.Text = "Barcode"

                If (coaxString = "Inner") Then
                    hideBarcodeRef()
                Else
                    showBarcodeRef()
                End If
            Else
                lblWeldInputCoax.Text = ""

                lblWeldInputBarcode1.Text = "Barcode"

                lblWeldInputBarcode2.Visible = False
                txtWeldInputBarcodeO1.Visible = False
            End If

            txtWeldInputBarcodeI.Text = dataRow.Item("BARCODE")
            txtWeldInputBarcodeO1.Text = dataRow.Item("BARCODE_REF")
            'txtWeldInputBarcodeO2.Text = dataRow.Item("BARCODE_OUT_2")

            txtWeldInputTubeType.Text = tubeType
            _COUPON_CODE = dataRow.Item("COUPON_CODE")
            _COUPON_TYPE = dataRow.Item("COUPON_TYPE")

            cboWeldInputHeat1.Text = dataRow.Item("HEAT_NUMBER_NAME_1")
            cboWeldInputHeat2.Text = dataRow.Item("HEAT_NUMBER_NAME_2")
            cboWeldInputJointType1.Text = dataRow.Item("JOINT_TYPE_NAME_1")
            cboWeldInputJointType2.Text = dataRow.Item("JOINT_TYPE_NAME_2")
            cboWeldInputSystem.Text = dataRow.Item("SYSTEM_TYPE_NAME")

            Me.tabWeldInput.SelectedIndex = 0
            Me.tabWeldInput.Refresh()

            MsgBox("You are editing " & dataRow.Item("BARCODE") & " now", MsgBoxStyle.Information, "EQAM")
        Else
            MsgBox("Invalid Action (ERR003)", MsgBoxStyle.Exclamation, "EQAM")
        End If        
    End Sub

    Private Sub cboWeldInputJointType1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboWeldInputJointType1.SelectedIndexChanged
        If (lblWeldInputSize.Text <> "" And cboWeldInputJointType1.Text() <> "") Then
            Dim heatNumber As String = fetchHeatNumberByWeldSizeJointType(_PROJECT_ID, lblWeldInputSize.Text, cboWeldInputJointType1.Text)
            cboWeldInputHeat1.Text = heatNumber
        End If
    End Sub

    Private Sub cboWeldInputJointType2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboWeldInputJointType2.SelectedIndexChanged
        If (lblWeldInputSize.Text <> "" And cboWeldInputJointType2.Text() <> "") Then
            Dim heatNumber As String = fetchHeatNumberByWeldSizeJointType(_PROJECT_ID, lblWeldInputSize.Text, cboWeldInputJointType2.Text)
            cboWeldInputHeat2.Text = heatNumber
        End If
    End Sub

    Private Sub cboWeldInputSystem_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboWeldInputSystem.SelectedIndexChanged
        Dim systemTypeId As String = cboWeldInputSystem.SelectedValue
        If (systemTypeId <> "") Then
            Dim drawingNumber As String = fetchDrawingNumberBySystemTypeId(systemTypeId)
            txtWeldInputDrawingNo.Text = drawingNumber
        End If
    End Sub
End Class